<form name="frmlist" id="frmlist" action="<?php echo $this->site['base_url']?>admin_advertisement/search" method="post" >
<table class="title" cellspacing="0" cellpadding="0">
  <tr>
    <td class="title_label"><?php echo Kohana::lang('advertisement_lang.tt_page')?></td>
	<td class="title_button">
	
    <button type="button" name="btn_new" class="button new" onclick="javascript:location.href='<?php echo $this->site['base_url']?>admin_advertisement/create'">
    <span><?php echo Kohana::lang('advertisement_lang.btn_new_advertisement') ?></span>
    </button>
    </td>
  </tr>
</table>

<table class="list_top" cellspacing="0" cellpadding="0">
  <tr>
    <td align="left"><?php echo Kohana::lang('admin_lang.lbl_search')?>:
    <select name="txt_type" id="sel_type" style="width:120" onchange="frmlist.submit();" >
      <option value="0"> - - - </option>
      <option value="1" <?php if(@$type==1)echo 'selected="selected"'?> ><?php echo Kohana::lang('advertisement_lang.lbl_left')?></option>
      <option value="2" <?php if(@$type==2)echo 'selected="selected"'?> ><?php echo Kohana::lang('advertisement_lang.lbl_right')?></option>
      <option value="3"<?php if(@$type==3)echo 'selected="selected"'?> ><?php echo Kohana::lang('advertisement_lang.lbl_top')?></option>
      <option value="4" <?php if(@$type==4)echo 'selected="selected"'?> ><?php echo Kohana::lang('advertisement_lang.lbl_bottom')?></option>
      <option value="5" <?php if(@$type==5)echo 'selected="selected"'?> ><?php echo Kohana::lang('advertisement_lang.lbl_middle')?></option>
    </select>
    &nbsp;&nbsp;
      <input name="txt_keyword" type="text" id="txt_keyword" value="<?php echo @$keyword?>"/>
    &nbsp;
    <button type="submit" name="btn_search" id="btn_search" class="button search" />
      <span><?php echo Kohana::lang('admin_lang.lbl_search')?></span>
    </button></td>
  </tr>
</table>

<table class="list" cellspacing="1" cellpadding="5">
	<tr class="list_header">
		<td width="10"><input type="checkbox" name="checkbox" value="checkbox" onclick='checkedAll(this.checked);'></td>
		<td><?php echo  Kohana::lang('advertisement_lang.lbl_name')?></td>
		<td width="200"><?php echo  Kohana::lang('advertisement_lang.lbl_url')?></td>
		<td width="80" align="center"><?php echo  Kohana::lang('advertisement_lang.lbl_position')?></td>
		<td width="80" align="center"><?php echo  Kohana::lang('advertisement_lang.lbl_image')?></td>
        <td width="80" align="center"><?php echo  Kohana::lang('admin_lang.lbl_order')?></td>
		<td width="80" align="center"><?php echo  Kohana::lang('admin_lang.lbl_status')?></td>
	  	<td width="80" align="center"><?php echo  Kohana::lang('admin_lang.lbl_action')?></td>
	</tr>
	<?php 
	
	for($i=0;$i<count($mlist);$i++){?>
	<tr class="row<?php echo $i%2==0?2:''?>">
    <td><input name="chk_id[]" type="checkbox" id="chk_id[]" value="<?php echo $mlist[$i]['adv_id']?>"></td>
    <td><a href="<?php echo $this->site['base_url']?>admin_advertisement/edit/<?php echo $mlist[$i]['adv_id']?>"><?php echo $mlist[$i]['adv_name']?></a></td>
    <td><a href="<?php echo $this->site['base_url']?>admin_advertisement/edit/<?php echo $mlist[$i]['adv_id']?>"><?php echo $mlist[$i]['adv_url']?></a></td>
    <td align="center">
        <a href="<?php echo $this->site['base_url']?>admin_advertisement/edit/<?php echo $mlist[$i]['adv_id']?>">
       
        <?php if($mlist[$i]['adv_position'] == 1)
			echo Kohana::lang('advertisement_lang.lbl_left');
        elseif($mlist[$i]['adv_position'] == 2)
			echo Kohana::lang('advertisement_lang.lbl_right');
		elseif( $mlist[$i]['adv_position'] == 3)
			echo Kohana::lang('advertisement_lang.lbl_top');
        elseif( $mlist[$i]['adv_position'] == 4)
			echo Kohana::lang('advertisement_lang.lbl_bottom');
		else echo Kohana::lang('advertisement_lang.lbl_middle');
        ?>
        </a>        
    </td>
    
    <td align="center">
    <?php 
	if(!empty($mlist[$i]['adv_image'])){
	$ext = explode('.',$mlist[$i]['adv_image']);
	$ext = $ext[1];
	} else {
		$ext='';
	}
	if($ext == 'swf') {?>
    
    <embed src="<?php echo $this->site['base_url']?>uploads/adv/<?php echo @$mlist[$i]['adv_image']?>" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" height="50"></embed>
    
    <?php } elseif( $ext == 'flv'){?>
    <div id="video">
        	You need to upgrade your Flash Player or to allow javascript to enable Website menu.</br>
        	<a href="http://www.adobe.com/go/getflashplayer">Get Flash Player</a>            
        </div>
        <script type='text/javascript' src='<?php echo $this->site['base_url']?>themes/plugins/mediaplayer/swfobject.js'></script>
        <script type='text/javascript'> 
        	var s1 = new SWFObject('<?php echo $this->site['base_url']?>themes/plugins/mediaplayer/player.swf','video','50','50','9'); 
        	s1.addParam('allowfullscreen','true'); 
        	s1.addParam('flashvars','file=<?php echo $this->site['base_url']?>uploads/adv/<?php echo @$mlist[$i]['adv_image']?>')
        	s1.write('video'); 
        </script>
    <?php }else {?>
   <a href="<?php echo $this->site['base_url']?>admin_advertisement/edit/<?php echo $mlist[$i]['adv_id']?>">
    <img src="<?php echo $this->site['base_url']?>uploads/adv/<?php echo @$mlist[$i]['adv_image']?>" height="50"></a>
    <?php } ?>
    </td>
    <td align="center">
    <a href="<?php echo $this->site['base_url']?>admin_advertisement/edit/<?php echo $mlist[$i]['adv_id']?>">
    <?php echo $mlist[$i]['adv_order']?>
    </a>
    </td>
    <td align="center">
	<?php if($mlist[$i]['adv_status']==1){?>
	<a href="<?php echo $this->site['base_url']?>admin_advertisement/setstatus/<?php echo $mlist[$i]['adv_id']?>/0" title="click to change status" ><img src="<?php echo $this->site['base_url']?>themes/admin/pics/icon_active.png" title="<?php echo Kohana::lang('admin_lang.lbl_active')?>" /></a>
	<?php }else{ ?>
	<a href="<?php echo $this->site['base_url']?>admin_advertisement/setstatus/<?php echo $mlist[$i]['adv_id']?>/1" title="click to change status" ><img src="<?php echo $this->site['base_url']?>themes/admin/pics/icon_inactive.png" title="<?php echo Kohana::lang('admin_lang.lbl_inactive')?>" /></a>
	<?php } ?>
    </td>
    <td align="center">
    <a href="<?php echo $this->site['base_url']?>admin_advertisement/edit/<?php echo $mlist[$i]['adv_id']?>"><img src="<?php echo $this->site['base_url']?>themes/admin/pics/icon_edit.png" title="<?php echo Kohana::lang('admin_lang.btn_edit')?>" /></a>
    <a href="<?php echo $this->site['base_url']?>admin_advertisement/delete/<?php echo $mlist[$i]['adv_id']?>"  onclick="return confirm('<?php echo Kohana::lang('errormsg_lang.msg_confirm_del')?>')"><img src="<?php echo $this->site['base_url']?>themes/admin/pics/icon_delete.png" title="<?php echo Kohana::lang('admin_lang.btn_delete')?>" /></a>
    </td>
  </tr>
  <?php }?>
</table> 

<table class="list_bottom" cellspacing="0" cellpadding="5">
  <tr>
    <td>
	<select name="sel_action" id="sel_action">
		<option value="blocked"><?php echo Kohana::lang('admin_lang.lbl_block_selected')?></option>
        <option value="active"><?php echo Kohana::lang('admin_lang.lbl_active_selected')?></option>		
		<option value="delete"><?php echo Kohana::lang('admin_lang.lbl_delete_selected')?></option>
	</select>
	<button type="button" name="btn_update" id="btn_update" class="button save" onclick="sm_frm(frmlist,'<?php echo $this->site['base_url']?>admin_advertisement/saveall','<?php echo Kohana::lang('errormsg_lang.msg_confirm_del')?>');"> <span><?php echo Kohana::lang('admin_lang.btn_update') ?></span>
    </button>
    </td>
  </tr>
</table>
</form>
<div class='pagination'><?php echo $this->pagination?></div>